<template>
  <el-button type="primary" @click="onChildClick(1)">子组件按钮</el-button>
  <div>{{ childrenData }}</div>
</template>
<script setup>
import {ref} from "vue";

const childrenData = ref(0)
const onChildClick = (props) => {
  childrenData.value += props
  console.log("父组件调用了子组件的方法", childrenData.value)
}
// 如果要在组件外部使用当前组件的数据状态，必须暴露。
defineExpose({childrenData, onChildClick})

</script>
<style scoped lang="less">

</style>